import request from '@/utils/request'


/**
 * 查询所有分类
 * @returns
 */
export function selectAllTypes() {
  return request({
    url: '/type/list',
    method: 'get',

  })

}

/**
 * 查询分类信息
 * @param {*} params
 * @returns
 */
export function listTypes(params) {
  return request({
    url: '/admin/type/list',
    method: 'post',
    data: {
      pageNum: params.pageNum,
      limit: params.limit
    }
  })

}
/**
 * 删除分类
 * @param {*} typeId
 * @returns
 */
export function deleteType(typeId) {
  return request({
    url: '/admin/type/' + typeId,
    method: 'delete'
  })
}
/**
 * 保存分类
 * @param {}} typeName
 * @returns
 */
export function saveType(typeName) {
  return request({
    url: '/admin/type/save',
    method: 'post',
    params: {
      typeName: typeName
    }
  })
}
/**
 * 获取
 * @param {*} typeId
 * @returns
 */
export function getType(typeId){
  return request({
    url:'/admin/type/'+typeId,
    method:'get',

  })
}
/**
 * 修改
 * @param {*} params
 * @returns
 */
export function editType(params){
  return request({
    url:'/admin/type',
    method:'put',
    data:{
      typeId:params.typeId,
      typeName:params.typeName
    }
  })
}
